package org.come.starcard;

import java.awt.Color;
import java.awt.Font;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JLabel;
import javax.swing.SwingConstants;

import org.come.Frame.NPCJfram;
import org.come.Frame.OptionsJframe;
import org.come.Frame.ZhuFrame;
import org.come.bean.SuitOperBean;
import org.come.entity.Goodstable;
import org.come.entity.PartJade;
import org.come.mouslisten.GoodsMouslisten;
import org.come.socket.Agreement;
import org.come.socket.SendMessageUntil;
import org.come.summonequip.JframeCashRewardsMain;
import org.come.until.CutButtonImage;
import org.come.until.FormsManagement;
import org.come.until.GoodsListFromServerUntil;
import org.come.until.GsonUtil;
import org.come.until.MessagrFlagUntil;
import org.come.until.Util;

import com.tool.btn.MoBanBtn;
import com.tool.role.RoleData;
import com.tool.role.RoleProperty;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;

import come.tool.JDialog.TiShiUtil;

public class BtnStarCard extends MoBanBtn {

    /**
     * jpanelStarCardMain面板按钮:<br>
     * 1属性菜单按钮<br>
     * 2重铸菜单按钮<br>
     * 3培养子菜单按钮<br>
     * 4升级子菜单按钮<br>
     * 5重洗子菜单按钮<br>
     * 6练星子菜单按钮<br>
     * 11锁图标<br>
     * 12解锁图标<br>
     * 20操作按钮<br>
     * 21参战按钮<br>
     * 22取出按钮<br>
     * 23魂归按钮<br>
     * 24兑换按钮<br>
     * 25补充按钮<br>
     * 26删除按钮<br>
     * 27转移按钮<br>
     * jpanelSoulBackMain面板按钮:<br>
     * 30确认按钮<br>
     * 31取消按钮<br>
     * 40确认转移按钮<br>
     */
    private int caozuo;
    private JpanelStarCardMain jpanelStarCardMain;
    private JpanelSoulBackMain jpanelSoulBackMain;
    private JpanelStarTransferMain jpanelStarTransferMain;

    public BtnStarCard(String iconpath, int type, String text, int caozuo, JpanelStarCardMain jpanelStarCardMain) {
        super(iconpath, type);
        this.caozuo = caozuo;
        if (caozuo >= 20) {
            setText(text);
            setHorizontalTextPosition(SwingConstants.CENTER);
            setVerticalTextPosition(SwingConstants.CENTER);
            setForeground(Color.yellow);
            setFont(UIUtils.TEXT_HY17);
        }
        this.jpanelStarCardMain = jpanelStarCardMain;
    }

    public BtnStarCard(String iconpath, int type, Color[] colors, Font font, String text, int caozuo,
                       JpanelStarCardMain jpanelStarCardMain) {
        super(iconpath, type, colors);
        this.caozuo = caozuo;
        setText(text);
        setHorizontalTextPosition(SwingConstants.CENTER);
        setVerticalTextPosition(SwingConstants.CENTER);
        setFont(font);
        this.jpanelStarCardMain = jpanelStarCardMain;
    }

    public BtnStarCard(String iconpath, int type, Color[] colors, Font font, String text, int caozuo,
                       JpanelSoulBackMain jpanelSoulBackMain) {
        super(iconpath, type, colors);
        this.caozuo = caozuo;
        setText(text);
        setHorizontalTextPosition(SwingConstants.CENTER);
        setVerticalTextPosition(SwingConstants.CENTER);
        setFont(font);

        this.jpanelSoulBackMain = jpanelSoulBackMain;
    }

    // public BtnStarCard(String iconpath, int type, String text, int caozuo,
    // JpanelStarTransferMain jpanelStarTransferMain) {
    // super(iconpath, type);
    // this.caozuo = caozuo;
    // setText(text);
    // setHorizontalTextPosition(SwingConstants.CENTER);
    // setVerticalTextPosition(SwingConstants.CENTER);
    // setForeground(UIUtils.getColor("yellow"));
    // setFont(UIUtils.TEXT_HY17);
    //
    // this.jpanelStarTransferMain = jpanelStarTransferMain;
    // }

    public BtnStarCard(String iconpath, int type, Color[] colors, Font font, String text, int caozuo,
                       JpanelStarTransferMain jpanelStarTransferMain) {
        super(iconpath, type, colors);
        this.caozuo = caozuo;
        setText(text);
        setHorizontalTextPosition(SwingConstants.CENTER);
        setVerticalTextPosition(SwingConstants.CENTER);
        setFont(font);

        this.jpanelStarTransferMain = jpanelStarTransferMain;
    }






    // public BtnStarCard(String iconpath, int type, String text, int caozuo,
    // JpanelStarTransferMain jpanelStarTransferMain) {
    // super(iconpath, type);
    // this.caozuo = caozuo;
    // setText(text);
    // setHorizontalTextPosition(SwingConstants.CENTER);
    // setVerticalTextPosition(SwingConstants.CENTER);
    // setForeground(UIUtils.getColor("yellow"));
    // setFont(UIUtils.TEXT_HY17);
    //
    // this.jpanelStarTransferMain = jpanelStarTransferMain;
    // }



    @Override
    public void chooseyes() {

    }

    @Override
    public void chooseno() {

    }

    @Override
    public void nochoose(MouseEvent e) {
        try {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                if (caozuo == 1) {
                    jpanelStarCardMain.getAttributeMenuBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B198.png"));
                    jpanelStarCardMain.getRecastMenuBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B199.png"));
                    jpanelStarCardMain.changeBigMenuLeftView(1);
                } else if (caozuo == 2) {
                    /**判断是否解锁*/
                    if (Util.isCanBuyOrno()) {
                        return;
                    }
                    jpanelStarCardMain.getAttributeMenuBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B197.png"));
                    jpanelStarCardMain.getRecastMenuBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B200.png"));
                    jpanelStarCardMain.changeBigMenuLeftView(2);
                } else if (caozuo == 3) {
                    jpanelStarCardMain.getCultivateBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B204.png"));
                    jpanelStarCardMain.getLianStarBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B201.png"));
                    jpanelStarCardMain.getUpgradeBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B205.png"));
                    jpanelStarCardMain.getRedoBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B207.png"));
                    jpanelStarCardMain.changeSmallMenuLeftView(1);
                } else if (caozuo == 4) {
                    jpanelStarCardMain.getCultivateBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B203.png"));
                    jpanelStarCardMain.getLianStarBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B201.png"));
                    jpanelStarCardMain.getUpgradeBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B206.png"));
                    jpanelStarCardMain.getRedoBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B207.png"));
                    jpanelStarCardMain.changeSmallMenuLeftView(2);
                } else if (caozuo == 5) {
                    jpanelStarCardMain.getCultivateBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B203.png"));
                    jpanelStarCardMain.getLianStarBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B201.png"));
                    jpanelStarCardMain.getUpgradeBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B205.png"));
                    jpanelStarCardMain.getRedoBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B208.png"));
                    jpanelStarCardMain.changeSmallMenuLeftView(3);
                } else if (caozuo == 6) {
                    jpanelStarCardMain.getCultivateBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B203.png"));
                    jpanelStarCardMain.getLianStarBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B202.png"));
                    jpanelStarCardMain.getUpgradeBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B205.png"));
                    jpanelStarCardMain.getRedoBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/B207.png"));
                    jpanelStarCardMain.changeSmallMenuLeftView(4);
                } else if (caozuo == 11) {
                    MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE10);
                } else if (caozuo == 12) {
                    if (Util.canBuyOrno) {// 已解锁
                        MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE11);
                    } else {// 未解锁
                        if (RoleData.getRoleData().getLoginResult().getPassword() == null) {
                            FormsManagement.showForm(32);
                        } else {
                            FormsManagement.showForm(33);
                        }
                    }
                } else if (caozuo == 20) {
                    // 培养操作
                    jpanelStarCardMain.caoZuoStarCard();
                } else if (caozuo == 21) {
                    BigDecimal chooseStarCardId = jpanelStarCardMain.getChooseStarCardId();
                    if (chooseStarCardId == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择要培养的星卡");
                        return;
                    }
                    Goodstable goodstable = GoodsListFromServerUntil.getRgid(chooseStarCardId);
                    if (goodstable == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择要培养的星卡");
                        return;
                    }
                    int parseInt = Integer.parseInt(goodstable.getValue().split("\\|")[2].split("=")[1]);
                    if (parseInt <= 0) {
                        ZhuFrame.getZhuJpanel().addPrompt2("战力不足无法参战");
                        return;
                    }
                    if (goodstable.getStatus() == 1) {
                        goodstable.setStatus(4);
                        GoodsMouslisten.gooduse(goodstable, 0);
                        GoodsListFromServerUntil.getChoseGoodsList()[13] = null;
                        jpanelStarCardMain.getJoinBtn().setText("参战");
                    } else {
                        if (GoodsListFromServerUntil.getChoseGoodsList()[13] == null) {
                            goodstable.setStatus(1);
                            GoodsListFromServerUntil.getChoseGoodsList()[13] = goodstable;
                            GoodsMouslisten.gooduse(goodstable, 0);
                        } else {
                            Goodstable goodstable2 = GoodsListFromServerUntil.getChoseGoodsList()[13];
                            List<Goodstable> starCardList = GoodsListFromServerUntil.getStarCardList();
                            for (int i = 0; i < starCardList.size(); i++) {
                                Goodstable goodstable3 = starCardList.get(i);
                                if (goodstable3.getRgid().compareTo(goodstable2.getRgid()) == 0) {
                                    goodstable3.setStatus(4);
                                    GoodsMouslisten.gooduse(goodstable3, 0);
                                }
                            }
                            goodstable.setStatus(1);
                            GoodsListFromServerUntil.getChoseGoodsList()[13] = goodstable;
                            GoodsMouslisten.gooduse(goodstable, 0);
                        }
                        jpanelStarCardMain.getJoinBtn().setText("待机");
                    }
                    RoleProperty.getRoleProperty().equipWearOff();
                } else if (caozuo == 22) {
                    /**判断是否解锁*/
                    if (Util.isCanBuyOrno()) {
                        return;
                    }
                    BigDecimal chooseStarCardId = jpanelStarCardMain.getChooseStarCardId();
                    if (chooseStarCardId == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择要培养的星卡");
                        return;
                    }
                    Goodstable goodstable = GoodsListFromServerUntil.getRgid(chooseStarCardId);
                    if (goodstable == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择要培养的星卡");
                        return;
                    }
                    OptionsJframe.getOptionsJframe().getOptionsJpanel()
                            .showBox(TiShiUtil.starCardDeposit, goodstable, "真的要取出该星卡吗?");
                } else if (caozuo == 23) {
                    /**判断是否解锁*/
                    if (Util.isCanBuyOrno()) {
                        return;
                    }
                    FormsManagement.showForm(96);
                } else if (caozuo == 24) {
                    /**判断是否解锁*/
                    if (Util.isCanBuyOrno()) {
                        return;
                    }
                    JframeCashRewardsMain.getJframeCashRewardsMain().getJpanelCashRewardsMain().setGoodsType(2);
                    FormsManagement.showForm(92);
                } else if (caozuo == 25) {
                    BigDecimal chooseStarCardId = jpanelStarCardMain.getChooseStarCardId();
                    if (chooseStarCardId == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择要补充的星卡");
                        return;
                    }
                    Goodstable goodstable = GoodsListFromServerUntil.getRgid(chooseStarCardId);
                    if (goodstable == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择要补充的星卡");
                        return;
                    }
                    NPCJfram.getNpcJfram().getNpcjpanel().showStarCardSupplement(goodstable);
                } else if (caozuo == 26) {
                    BigDecimal chooseStarCardId = jpanelStarCardMain.getChooseStarCardId();
                    if (chooseStarCardId == null) {
                        return;
                    }
                    Goodstable goodstable = GoodsListFromServerUntil.getRgid(chooseStarCardId);
                    if (goodstable == null) {
                        return;
                    }
                    OptionsJframe.getOptionsJframe().getOptionsJpanel()
                            .showBox(TiShiUtil.starCard, goodstable, "真的要删除该星卡的星阵吗？删除后不可恢复");
                } else if (caozuo == 27) {
                    if (jpanelStarCardMain.getChooseStarCardId() == null) {
                        return;
                    }
                    Goodstable goodstable = GoodsListFromServerUntil.getRgid(jpanelStarCardMain.getChooseStarCardId());
                    if (goodstable == null) {
                        return;
                    }
                    String[] values = goodstable.getValue().split("\\|");
                    String[] split2 = values[3].split("&");
                    for (int i = 0; i < split2.length; i++) {
                        if (split2[i].startsWith("星阵属性")) {
                            String[] split = split2[i].split("=");
                            if (!isfiveElements(split[1])) {
                                ZhuFrame.getZhuJpanel().addPrompt2("不是四神兽星阵无法转移");
                                return;
                            }
                            JframeStarTransferMain.getJframeStarTransferMain().getJpanelStarTransferMain()
                                    .showStarCardAttribute(0, split, goodstable);
                            JframeStarTransferMain.getJframeStarTransferMain().getJpanelStarTransferMain()
                                    .showStarCardAttribute(1, null, null);
                        }
                    }
                    FormsManagement.showForm(97);
                } else if (caozuo == 30) {
                    ArrayList<BigDecimal> starCardList = jpanelSoulBackMain.getStarCardList();
                    if (starCardList == null) {
                        return;
                    }
                    if (starCardList.size() == 0) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择至少一个要魂归的星卡");
                        return;
                    }
                    SuitOperBean suitOperBean = new SuitOperBean();
                    suitOperBean.setGoods(starCardList);
                    suitOperBean.setType(57);
                    String sendmes = Agreement.suitOperateAgreement(GsonUtil.getGsonUtil().getgson().toJson(suitOperBean));
                    SendMessageUntil.toServer(sendmes);
                    // for (int i = 0; i < starCardList.size(); i++) {
                    // Goodstable goodstable =
                    // GoodsListFromServerUntil.getRgid(starCardList.get(i));
                    // JframeStarCardMain.getJframeSummonEquipMain().getJpanelStarCardMain().deductGoods(goodstable,
                    // 1);
                    // }
                    starCardList.clear();
                } else if (caozuo == 31) {
                    FormsManagement.HideForm(96);
                    jpanelSoulBackMain.getStarCardList().clear();
                } else if (caozuo == 40) {
                    BigDecimal chooseOneId = jpanelStarTransferMain.getChooseOneId();
                    BigDecimal chooseTwoId = jpanelStarTransferMain.getChooseTwoId();

                    if (chooseOneId == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择主卡");
                        return;
                    }
                    if (chooseTwoId == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择副卡");
                        return;
                    }
                    Goodstable chooseOneGoods = GoodsListFromServerUntil.getRgid(chooseOneId);
                    if (chooseOneGoods == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择主卡");
                        return;
                    }
                    Goodstable chooseTwoGoods = GoodsListFromServerUntil.getRgid(chooseTwoId);
                    if (chooseTwoGoods == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择副卡");
                        return;
                    }
                    if (chooseOneId.compareTo(chooseTwoId) == 0) {
                        ZhuFrame.getZhuJpanel().addPrompt2("不能选择一样的星卡");
                        return;
                    }
                    int suitId = -1;
                    for (int i = 0; i < jpanelStarTransferMain.getRadioLabLeft().length; i++) {
                        JLabel jLabel = jpanelStarTransferMain.getRadioLabLeft()[i];
                        if (jLabel.getIcon() != null) {
                            suitId = i;
                            break;
                        }
                    }
                    if (suitId == -1) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择主卡要被替换的星阵宫");
                        return;
                    }
                    int partId = -1;
                    for (int i = 0; i < jpanelStarTransferMain.getRadioLabRight().length; i++) {
                        JLabel jLabel = jpanelStarTransferMain.getRadioLabRight()[i];
                        if (jLabel.getIcon() != null) {
                            partId = i;
                            break;
                        }
                    }
                    if (partId == -1) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择副卡要替换的星阵宫");
                        return;
                    }
                    PartJade partJade = new PartJade(suitId, partId);
                    SuitOperBean operBean = new SuitOperBean();
                    List<BigDecimal> goods = new ArrayList<>();
                    goods.add(chooseOneId);
                    goods.add(chooseTwoId);
                    operBean.setGoods(goods);
                    operBean.setType(56);
                    operBean.setJade(partJade);
                    String sendmes = Agreement.suitOperateAgreement(GsonUtil.getGsonUtil().getgson().toJson(operBean));
                    SendMessageUntil.toServer(sendmes);
                    JframeStarCardMain.getJframeSummonEquipMain().getJpanelStarCardMain().deductGoods(chooseTwoGoods, 1);
                }
            } else {
                if (caozuo == 1) {
                    jpanelStarCardMain.getAttributeMenuBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/属性按钮w63,h78.png"));
                    jpanelStarCardMain.getRecastMenuBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/重铸未w63,h78px.png"));
                    jpanelStarCardMain.changeBigMenuLeftView(1);
                } else if (caozuo == 2) {
                    /**判断是否解锁*/
                    if (Util.isCanBuyOrno()) {
                        return;
                    }

                    jpanelStarCardMain.getAttributeMenuBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/属性按钮2-w63,h78.png"));
                    jpanelStarCardMain.getRecastMenuBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/重铸w63,h78px.png"));
                    jpanelStarCardMain.changeBigMenuLeftView(2);
                } else if (this.caozuo == 3) {
                    jpanelStarCardMain.getCultivateBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/培养按钮2-W：30-H：138.png"));
                    jpanelStarCardMain.getLianStarBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/练星按钮-W：30-H：138.png"));
                    jpanelStarCardMain.getUpgradeBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/升级按钮-W：30-H：138.png"));
                    jpanelStarCardMain.getRedoBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/重洗按钮-W：30-H：138.png"));
                    jpanelStarCardMain.changeSmallMenuLeftView(1);
                } else if (this.caozuo == 4) {
                    jpanelStarCardMain.getCultivateBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/培养按钮-W：30-H：138.png"));
                    jpanelStarCardMain.getLianStarBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/练星按钮-W：30-H：138.png"));
                    jpanelStarCardMain.getUpgradeBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/升级按钮2-W：30-H：138.png"));
                    jpanelStarCardMain.getRedoBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/重洗按钮-W：30-H：138.png"));
                    jpanelStarCardMain.changeSmallMenuLeftView(2);
                } else if (this.caozuo == 5) {
                    jpanelStarCardMain.getCultivateBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/培养按钮-W：30-H：138.png"));
                    jpanelStarCardMain.getLianStarBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/练星按钮-W：30-H：138.png"));
                    jpanelStarCardMain.getUpgradeBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/升级按钮-W：30-H：138.png"));
                    jpanelStarCardMain.getRedoBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/重洗按钮2-W：30-H：138.png"));
                    jpanelStarCardMain.changeSmallMenuLeftView(3);
                } else if (this.caozuo == 6) {
                    jpanelStarCardMain.getCultivateBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/培养按钮-W：30-H：138.png"));
                    jpanelStarCardMain.getLianStarBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/练星按钮2-W：30-H：138.png"));
                    jpanelStarCardMain.getUpgradeBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/升级按钮-W：30-H：138.png"));
                    jpanelStarCardMain.getRedoBtn().setIcons(CutButtonImage.cuts("inkImg/hongmu/2/重洗按钮-W：30-H：138.png"));
                    jpanelStarCardMain.changeSmallMenuLeftView(4);
                } else if (caozuo == 11) {
                    MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE10);
                } else if (caozuo == 12) {
                    if (Util.canBuyOrno) {// 已解锁
                        MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE11);
                    } else {// 未解锁
                        if (RoleData.getRoleData().getLoginResult().getPassword() == null) {
                            FormsManagement.showForm(32);
                        } else {
                            FormsManagement.showForm(33);
                        }
                    }
                } else if (caozuo == 20) {
                    // 培养操作
                    jpanelStarCardMain.caoZuoStarCard();
                } else if (caozuo == 21) {
                    BigDecimal chooseStarCardId = jpanelStarCardMain.getChooseStarCardId();
                    if (chooseStarCardId == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择要培养的星卡");
                        return;
                    }
                    Goodstable goodstable = GoodsListFromServerUntil.getRgid(chooseStarCardId);
                    if (goodstable == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择要培养的星卡");
                        return;
                    }
                    int parseInt = Integer.parseInt(goodstable.getValue().split("\\|")[2].split("=")[1]);
                    if (parseInt <= 0) {
                        ZhuFrame.getZhuJpanel().addPrompt2("战力不足无法参战");
                        return;
                    }
                    if (goodstable.getStatus() == 1) {
                        goodstable.setStatus(4);
                        GoodsMouslisten.gooduse(goodstable, 0);
                        GoodsListFromServerUntil.getChoseGoodsList()[13] = null;
                        jpanelStarCardMain.getJoinBtn().setText("参 战");
                    } else {
                        if (GoodsListFromServerUntil.getChoseGoodsList()[13] == null) {
                            goodstable.setStatus(1);
                            GoodsListFromServerUntil.getChoseGoodsList()[13] = goodstable;
                            GoodsMouslisten.gooduse(goodstable, 0);
                        } else {
                            Goodstable goodstable2 = GoodsListFromServerUntil.getChoseGoodsList()[13];
                            List<Goodstable> starCardList = GoodsListFromServerUntil.getStarCardList();
                            for (int i = 0; i < starCardList.size(); i++) {
                                Goodstable goodstable3 = starCardList.get(i);
                                if (goodstable3.getRgid().compareTo(goodstable2.getRgid()) == 0) {
                                    goodstable3.setStatus(4);
                                    GoodsMouslisten.gooduse(goodstable3, 0);
                                }
                            }
                            goodstable.setStatus(1);
                            GoodsListFromServerUntil.getChoseGoodsList()[13] = goodstable;
                            GoodsMouslisten.gooduse(goodstable, 0);
                        }
                        jpanelStarCardMain.getJoinBtn().setText("待 机");
                    }
                    RoleProperty.getRoleProperty().equipWearOff();
                } else if (caozuo == 22) {
                    /**判断是否解锁*/
                    if (Util.isCanBuyOrno()) {
                        return;
                    }
                    BigDecimal chooseStarCardId = jpanelStarCardMain.getChooseStarCardId();
                    if (chooseStarCardId == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择要培养的星卡");
                        return;
                    }
                    Goodstable goodstable = GoodsListFromServerUntil.getRgid(chooseStarCardId);
                    if (goodstable == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择要培养的星卡");
                        return;
                    }
                    OptionsJframe.getOptionsJframe().getOptionsJpanel()
                            .showBox(TiShiUtil.starCardDeposit, goodstable, "真的要取出该星卡吗?");
                } else if (caozuo == 23) {
                    /**判断是否解锁*/
                    if (Util.isCanBuyOrno()) {
                        return;
                    }
                    FormsManagement.showForm(96);
                } else if (caozuo == 24) {
                    /**判断是否解锁*/
                    if (Util.isCanBuyOrno()) {
                        return;
                    }
                    JframeCashRewardsMain.getJframeCashRewardsMain().getJpanelCashRewardsMain().setGoodsType(2);
                    FormsManagement.showForm(92);
                } else if (caozuo == 25) {
                    BigDecimal chooseStarCardId = jpanelStarCardMain.getChooseStarCardId();
                    if (chooseStarCardId == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择要补充的星卡");
                        return;
                    }
                    Goodstable goodstable = GoodsListFromServerUntil.getRgid(chooseStarCardId);
                    if (goodstable == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择要补充的星卡");
                        return;
                    }
                    NPCJfram.getNpcJfram().getNpcjpanel().showStarCardSupplement(goodstable);
                } else if (caozuo == 26) {
                    BigDecimal chooseStarCardId = jpanelStarCardMain.getChooseStarCardId();
                    if (chooseStarCardId == null) {
                        return;
                    }
                    Goodstable goodstable = GoodsListFromServerUntil.getRgid(chooseStarCardId);
                    if (goodstable == null) {
                        return;
                    }
                    OptionsJframe.getOptionsJframe().getOptionsJpanel()
                            .showBox(TiShiUtil.starCard, goodstable, "真的要删除该星卡的星阵吗？删除后不可恢复");
                } else if (caozuo == 27) {
                    if (jpanelStarCardMain.getChooseStarCardId() == null) {
                        return;
                    }
                    Goodstable goodstable = GoodsListFromServerUntil.getRgid(jpanelStarCardMain.getChooseStarCardId());
                    if (goodstable == null) {
                        return;
                    }
                    String[] values = goodstable.getValue().split("\\|");
                    String[] split2 = values[3].split("&");
                    for (int i = 0; i < split2.length; i++) {
                        if (split2[i].startsWith("星阵属性")) {
                            String[] split = split2[i].split("=");
                            if (!isfiveElements(split[1])) {
                                ZhuFrame.getZhuJpanel().addPrompt2("不是四神兽星阵无法转移");
                                return;
                            }
                            JframeStarTransferMain.getJframeStarTransferMain().getJpanelStarTransferMain()
                                    .showStarCardAttribute(0, split, goodstable);
                            JframeStarTransferMain.getJframeStarTransferMain().getJpanelStarTransferMain()
                                    .showStarCardAttribute(1, null, null);
                        }
                    }
                    FormsManagement.showForm(97);
                } else if (caozuo == 30) {
                    ArrayList<BigDecimal> starCardList = jpanelSoulBackMain.getStarCardList();
                    if (starCardList == null) {
                        return;
                    }
                    if (starCardList.size() == 0) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择至少一个要魂归的星卡");
                        return;
                    }
                    SuitOperBean suitOperBean = new SuitOperBean();
                    suitOperBean.setGoods(starCardList);
                    suitOperBean.setType(57);
                    String sendmes = Agreement.suitOperateAgreement(GsonUtil.getGsonUtil().getgson().toJson(suitOperBean));
                    SendMessageUntil.toServer(sendmes);
                    // for (int i = 0; i < starCardList.size(); i++) {
                    // Goodstable goodstable =
                    // GoodsListFromServerUntil.getRgid(starCardList.get(i));
                    // JframeStarCardMain.getJframeSummonEquipMain().getJpanelStarCardMain().deductGoods(goodstable,
                    // 1);
                    // }
                    starCardList.clear();
                } else if (caozuo == 31) {
                    FormsManagement.HideForm(96);
                    jpanelSoulBackMain.getStarCardList().clear();
                } else if (caozuo == 40) {
                    BigDecimal chooseOneId = jpanelStarTransferMain.getChooseOneId();
                    BigDecimal chooseTwoId = jpanelStarTransferMain.getChooseTwoId();

                    if (chooseOneId == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择主卡");
                        return;
                    }
                    if (chooseTwoId == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择副卡");
                        return;
                    }
                    Goodstable chooseOneGoods = GoodsListFromServerUntil.getRgid(chooseOneId);
                    if (chooseOneGoods == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择主卡");
                        return;
                    }
                    Goodstable chooseTwoGoods = GoodsListFromServerUntil.getRgid(chooseTwoId);
                    if (chooseTwoGoods == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择副卡");
                        return;
                    }
                    if (chooseOneId.compareTo(chooseTwoId) == 0) {
                        ZhuFrame.getZhuJpanel().addPrompt2("不能选择一样的星卡");
                        return;
                    }
                    int suitId = -1;
                    for (int i = 0; i < jpanelStarTransferMain.getRadioLabLeft().length; i++) {
                        JLabel jLabel = jpanelStarTransferMain.getRadioLabLeft()[i];
                        if (jLabel.getIcon() != null) {
                            suitId = i;
                            break;
                        }
                    }
                    if (suitId == -1) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择主卡要被替换的星阵宫");
                        return;
                    }
                    int partId = -1;
                    for (int i = 0; i < jpanelStarTransferMain.getRadioLabRight().length; i++) {
                        JLabel jLabel = jpanelStarTransferMain.getRadioLabRight()[i];
                        if (jLabel.getIcon() != null) {
                            partId = i;
                            break;
                        }
                    }
                    if (partId == -1) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请选择副卡要替换的星阵宫");
                        return;
                    }
                    PartJade partJade = new PartJade(suitId, partId);
                    SuitOperBean operBean = new SuitOperBean();
                    List<BigDecimal> goods = new ArrayList<>();
                    goods.add(chooseOneId);
                    goods.add(chooseTwoId);
                    operBean.setGoods(goods);
                    operBean.setType(56);
                    operBean.setJade(partJade);
                    String sendmes = Agreement.suitOperateAgreement(GsonUtil.getGsonUtil().getgson().toJson(operBean));
                    SendMessageUntil.toServer(sendmes);
                    JframeStarCardMain.getJframeSummonEquipMain().getJpanelStarCardMain().deductGoods(chooseTwoGoods, 1);
                }
            }

        } catch (Exception e1) {
            e1.printStackTrace();
        }
    }

    /**
     * 判断是否是四神兽
     */
    public static boolean isfiveElements(String value) {
        if ("朱雀".equals(value) || "玄武".equals(value) || "白虎".equals(value) || "青龙".equals(value)) {
            return true;
        }
        return false;
    }
}
